﻿<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">网站日志</a></li>
        <li class="right"><a href="javascript:void(0)" onclick="LoadData()" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a></li>
    </ul>
</div>
<div class="main">
    <ul class="navTabs">
        <li data-tab-params="tabName:'管理员操作',tabValue:'3',tabValueObjName:'#logType'"></li>
        <li data-tab-params="tabName:'管理员登录',tabValue:'5',tabValueObjName:'#logType'"></li>
        <li data-tab-params="tabName:'会员登录',tabValue:'6',tabValueObjName:'#logType'"></li>
        <li data-tab-params="tabName:'自动任务',tabValue:'2',tabValueObjName:'#logType'"></li>
        <li data-tab-params="tabName:'错误',tabValue:'1',tabValueObjName:'#logType'"></li>
        <li data-tab-params="tabName:'应用程序',tabValue:'0',tabValueObjName:'#logType'"></li>
        <li data-tab-params="tabName:'升级',tabValue:'11',tabValueObjName:'#logType'"></li>
        <li data-tab-params="tabName:'其他',tabValue:'100',tabValueObjName:'#logType'"></li>
    </ul>
    <table border=0 cellpadding=0 cellspacing=0 class="tb-head form-inline form-group-sm">
        <tr>
            <td>
                <div class="btn-group btn-group-sm">
                    <button type="button" class="btn btn-default btn-sm ui-selectInvert">反选</button>
                    <button type="button" class="btn btn-default dropdown-toggle btn-sm" data-toggle="dropdown" aria-expanded="false">
                        菜单
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="javascript:void(0)" class="ui-deleteMultiple" data-custom-params="url:'@Url.ActionUrl("Delete")',callBack:'LoadData'">删除</a></li>
                    </ul>
                </div>
            </td>
            <td align="right">
                <div class="form-inline">
                    <input type="hidden" id="logType" name="logType" class="ui-queryString" value="3" />
                  
                    <select class="form-control form-control-xs  ui-setName">
                        <option value="message">按日志内容搜索</option>
                        <option value="username">按用户名搜索</option>
                        <option value="url">按url搜索</option>
                        <option value="ip">按Ip搜索</option>
                        <option value="thedate" searchType="range" valueType="date">按时间范围</option>
                    </select>
                    <input type="text" id="message" name="message" maxlength="50" placeholder="搜索关键词" class="form-control ui-keyword ui-queryString">
                    <button type="button" class="btn btn-default btn-sm ui-queryString-search">确定</button>
                </div>
            </td>
        </tr>
    </table>
    <table border=0 cellpadding=0 cellspacing=0 class="table table-bordered" id="tb_list">
        <thead>
            <tr>
                <td align="center" style="width:40px"><input type="checkbox" title="选择" class="ui-selectInvert" data-custom-params="isReverse:false"></td>
                <td align=left>日志</td>
                <td align="center" class="lb_url_head">Url</td>
                <td align="center" class="lb_ip_head">Ip</td>
                <td align="center" class="lb_user_head">User</td>
                <td align="center">Date</td>
            </tr>
        </thead>
        <tr class="item list-template-item" id="item_{id}">
            <td align="center">
                <input type="checkbox" value="{id}" class="checked-item">
                <input type="hidden" name="id" value="{id}" />
            </td>
            <td align=left>{message}</td>
            <td align=left><span class="lb_url">{url}</span></td>
            <td align="center"  width="120px"><span class="lb_ip">{ip}</span></td>
            <td align="center" width="120px"><span class="lb_user">{username}</span></td>
            <td align="center" width="150px">{thedate}</td>
        </tr>
    </table>
</div>
<script type="text/javascript">
    $(".navTabs").children().InitTab(function () { LoadData() }); //初始化选项卡，并设置回调函数为LoadData()

    function LoadedInit() {
        SetState("lb_url", "lb_url_head");
        SetState("lb_ip", "lb_ip_head");
        SetState("lb_user", "lb_user_head");
    }

    function SetState(itemClass,headClass)
    {
        var $item = $("." + itemClass);
        var $head = $("." + headClass);
        var hasValue = false;
        $item.each(function () {
            if ($(this).text() != "")
            {
                hasValue = true;
                return false;
            }
        });
        if (!hasValue) {
            $head.hide();
            $item.parent().hide();
        }
        else {
            $head.show();
        }
    }
    function LoadData() {
        var url = "@Url.ActionUrl("PageListData")";
        $("#tb_list").ListBind({ url: url, callBack: "LoadedInit" });
    }
    LoadData();
</script>




